<template>
    <view class="step6-box step-box">
        <UNavbar title="注意事项"> </UNavbar>

        <up-table class="manb20">
            <!-- <up-tr>
                <up-th>风险点</up-th>
                <up-th>防范措施</up-th>
                <up-th>应急措施</up-th>
            </up-tr> -->
            <up-tr v-for="item in data.emps">
                <up-td>{{ item.desc }}</up-td>
            </up-tr>
        </up-table>
        <TabStep @leftClick="onLeftClick" @rightClick="onRightClick"></TabStep>
    </view>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue';
import { onHide } from '@dcloudio/uni-app'; // Uniapp 页面生命周期
import TabStep from './TabStep.vue';
import UNavbar from '@/components/YNavbar/index.vue';
onMounted(() => {
    initAudio();
});

// 页面隐藏时停止播放
onHide(() => {
    destroyAudio();
});
let audio = ref(null);
const initAudio = () => {
    audio.value = uni.createInnerAudioContext();
    audio.value.src = '/static/t7.mp3'; // 替换为实际音频URL
    try {
        audio.value.play();
        console.log('正在播放...');
    } catch (error) {
        console.error('播放失败:', error);
        uni.showToast({
            title: '自动播放失败',
            icon: 'error',
        });
    }
};
const destroyAudio = () => {
    audio.value.destroy();
};

const data = reactive({
    emps: [
        {
            desc: '1、严禁非作业人员穿行打围区域；',
        },
        {
            desc: '2、人员扶梯时要戴好安全帽；',
        },
        {
            desc: '3、使用升降机时，要首先进行空载试验；',
        },
        {
            desc: '4、攀登脚手架、人字梯之前要先检查；',
        },
        {
            desc: '5、人员上下脚手架时，手中不能持物；',
        },
        {
            desc: '6、作业时严禁将作业工具甩上甩下；',
        },
        {
            desc: '7、打围时，要四方打围，打围半径大于5米同时大于作业高度，打围高度1米；',
        },
        {
            desc: '8、设备设施维修保养时，要首先验电；',
        },
        {
            desc: '9、作业前，人员、施工机具、材料要准备充分；',
        },
    ],
});
const onLeftClick = () => {
    uni.navigateTo({
        url: '/pages/home/forms/step6',
    });
};

const onRightClick = () => {
    uni.navigateTo({
        url: '/pages/home/forms/step8',
    });
};
</script>

<style lang="scss">
.step6-box {
    .u-td {
        height: auto;
    }
}
</style>
